/**
 * 
 */


import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.furschina.model.Channel;
import com.furschina.service.ChannelService;
import com.furschina.vo.ChannelPage;

/**
 * @author iday
 *
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath*:spring-test.xml")
public class ChannelServiceTestCase {
	@Autowired ChannelService service;
	List<Channel> list = new ArrayList<Channel>();

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		Channel c = new Channel();
		c.setLabel("时尚");
		service.create(c);
		list.add(c);
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
		service.deleteAll(list);
	}

	/**
	 * Test method for {@link com.furschina.service.ChannelService#findAll(com.furschina.vo.ChannelPage)}.
	 */
	@Test
	public void testFindAllChannelPage() {
		ChannelPage page = new ChannelPage();
		page.setRoot(true);
		Collection<Channel> channels = service.findAll(page);
		assertFalse(channels.isEmpty());
	}

}
